<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<script type="text/javascript">
	function check() {
		var name=$("#name").val();
		var time=$("#time").val();
		var rain=$("#rain").val();
		var station=$("#station").val();
		var address=$("#address").val();
		
		if (name=="" || station=="" || address=="") {
			alert("名称或监测站或站点地址有误!");
			return false;
		}
		if (time=="" || !(isNaN(time) && !isNaN(Date.parse(time)))) {
			alert("监测时间必须是yyyy-MM-dd格式");
			return false;
		}
		if (rain=="" || isNaN(rain)) {
			alert("雨量值必须是数字");
			return false;
		}
		return true;
		
	}
</script>
</head>
<body>
	<div>
	<form action="Add" method="post" onsubmit="return check()">
		区域名称:<input type="text" name="name" id="name"><br><br>
		监测时间:<input type="text" name="time" id="time"><span>yyyy-MM-dd格式</span><br><br>
		雨量值(mm):<input type="text" name="rain" id="rain"><br><br>
		监测站:<input type="text" name="station" id="station"><br><br>
		站点地址:<input type="text" name="address" id="address"><br><br>
		<input type="submit" value="保存">&nbsp;&nbsp;
		<input type="reset" value="重置">&nbsp;&nbsp;
		<input type="button" value="返回" onclick="history.back()">
	</form>
	</div>
</body>
</html>